function [result] = read4(input,dim1,dim2,dim3,dim4)
    result(dim1,dim2,dim3,dim4)=0.0;
    a=dim4*dim3*dim2;
    b=dim4*dim3;
    c=dim4;
    for h=1:dim1
        for i=1:dim2
            for j=1:dim3
                for k=1:dim4
                    result(h,i,j,k)=input(a*(h-1)+b*(i-1)+c*(j-1)+k);
                end
            end
        end
    end
    
end

